<?php session_start(); ?>
<?php include "libfunc.php";?>
<?php if (!empty($_SESSION['admUser']) && !empty($_SESSION['admPass'])) { ?>
<html>
 <head>
  <title>.: Admin Room ClothingCorp :.</title>
  <link href="admInc/cssMainStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssAdditionStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableNavigation.css" type="text/css" rel="stylesheet">
 </head>
 <body class="fix">
  <div id="wrapper">
   <div id="header">
    <div class="titleHeader"><center>
     <img src="image/logo2.png" border="0">
	</div><!-- titleHeader //-->
	<div class="subTitleHeader"><center>
	 - Website Administrator Control Panel -
	</div><!-- subTitleHeader //-->
   </div><!-- header //--></center>
   <div id="mainContent">
    <div id="leftColumn">
	 <div class="navigation">
	  <table border="0" width="100%" bgcolor="white">
	  <tr>
	    <td class="headerTable" align="center"><b>Admin Page</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="adminLayout.php"> Halaman Utama</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="newInformation.php"> Informasi Terkini</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="LogOut.php" onClick="return confirm('Apakah Anda benar-benar akan keluar dari halaman Admin ?')"> Keluar</a></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Kategori</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_kategori.php"> Tambah Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_kategori.php"> View Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_kategori.php"> Pencarian Kategori</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Member</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_member.php"> Tambah Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_member.php"> View Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_member.php"> Pencarian Member</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_produk.php"> View Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_produk.php"> Pencarian Produk</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Penjual</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_pejual.php"> Tambah Penjual</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_penjual.php"> View Penjual</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_penjual.php"> Pencarian Penjual</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Pesanan</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_pesanan.php"> View Pesanan</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_pesanan.php"> Pencarian Pesanan</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  
	</table>
	 </div><!-- navigation //-->
	</div><!-- leftColumn //-->
	<div id="rightColumn">
	 <div class="content">
	<?php 
	  $id = $_GET[id]; // ambil id pesanan
	  $idm = $_GET[idm]; // ambil id member
	  
	  //-------- koneksi ke database
	  $link = koneksi_db();
	  $sql  = "SELECT * FROM dtpesanan_item WHERE id_pesanan = '$id'";
	  $res  = mysql_query($sql,$link);
	  
	  //--------- end of koneksi database
    ?>   
      <!-- View Data Detail Pesanan buku //-->
      <fieldset>
       <legend>Data Detail Pesanan Buku</legend>
        <span class='title_view'>Data Item Pesanan</span>
		<table align="center" class="tableView">
         <tr class="trTable">
		   <td>ID Buku</td>
		   <td>Judul</td>
		   <td>Jumlah</td>
		   <td>Harga</td>
		   <td>Diskon</td>
		   <td>Total</td>
		 </tr>
		 
		   <?php
		    $total_bayar = 0;
			while ($data = mysql_fetch_array($res)) : ?>
				<tr>
				<td><?php echo $data['id_buku']?></td>
				<td>
					<?php
						$judul = get_judul_buku($data['id_buku']);
						echo $judul;
					?>
				</td>
				<td>
					<?php
						echo $data['qty'];
					?>
				</td>
				<td>
					<?php
						echo $data['harga'];
					?>
				</td>
				<td>
					<?php
						echo $data['diskon'];
					?>
				</td>
				<td>Rp. 
					<?php
						$total = $data['qty'] * $data['harga'];
						echo $total;
					?>
				</td>
				</tr>
			<?php
			$total_bayar = $total_bayar + $total;
			endwhile
		   ?>
		 
		 <tr>
			<td colspan='6'><hr></td>
		 </tr>
		 <tr>
			<td colspan=4 align=right>Total Bayar : </td>
			<td colspan=2 align=center>Rp. <?php echo $total_bayar; ?></td>
		 </tr>
		</table>
		
		<span class='title_view'>Data Member</span>
		<table align="center" class="tableView">
         <tr class="trTable">
		   <td>ID Member</td>
		   <td>Nama</td>
		   <td>Alamat</td>
		   <td>Email</td>
		   <td>Telpon</td>
		   <td>Kota</td>
		 </tr>
		 
		   <?php
		    $kon = koneksi_db();
			$sql = "select * from dtmember where id_member = '$idm'";
			$q	 = mysql_query($sql,$kon);
			
			while ($d = mysql_fetch_array($q)) : ?>
				<tr>
				<td><?php echo $d['id_member']?></td>
				<td>
					<?php
						echo $d['nama'];
					?>
				</td>
				<td>
					<?php
						echo $d['alamat'];
					?>
				</td>
				<td>
					<?php
						echo $d['email'];
					?>
				</td>
				<td>
					<?php
						echo $d['tlp'];
					?>
				</td>
				<td> 
					<?php
						echo $d['kota'];
					?>
				</td>
				</tr>
			<?php
			endwhile
		   ?>
		</table>
	  </fieldset>
      <!-- View Data buku//-->
      
      <!-- keterangan //-->
	  <div id="keterangan">
       <fieldset>
        <legend>Keterangan</legend>
         Menu View Data Pesanan Buku. Silahkan melihat data pesanan !!!
       </fieldset>
       </div><!-- keterangan //-->
	 </div><!-- content //-->
	</div><!-- rightColumn //-->
   </div><!-- mainContent //-->
  </div><!-- wrapper //-->
 </body>
</html>

<?php
}else{
  echo "<script language='javascript'>alert('Silakan Sign In Terlebih Dahulu')</script>";
  echo "<script language='javascript'>window.location = '../admin/'</script>";
}